<?php
use_helper('Text');

function forum_breadcrumb($params, $options = array())
{
  if(!$params) return;

  foreach ($params as $step) 
  {
    if(is_array($step))
    {
      isicsBreadcrumbs::getInstance()->addItem($step[0], $step[1]);
    }
    else
    {
      isicsBreadcrumbs::getInstance()->addItem(truncate_text($step, 30), '#');
    }
  }
}

function forum_rank($rankArray = array(), $nb_posts = 0)
{
  $choosedRank = null;
  foreach($rankArray as $rank)
  {
    if($rank['nb_posts'] <= $nb_posts)
    {
      $choosedRank = $rank;
    }
  }

  return $choosedRank;
}
